<?php
if(!function_exists('icon_for_list')) {
  function icon_for_list($file_name)
  {
    $supported = array(
      'xls', 'xlsx',
      'doc', 'docx',
      'ppt', 'pptx',
      'pdf', 
      'zip', 'rar', 'gz', '7z'
    );
    
    $translation = array(
      'xls', 'xls',
      'doc', 'doc',
      'ppt', 'ppt',
      'pdf', 
      'zip', 'zip', 'zip', 'zip'
    );
    
    $file_name = explode('.', $file_name);
    $ext = $file_name[count($file_name) - 1];
    
    if(in_array($ext, $supported)) {
      return str_replace($supported, $translation, $ext);
    }
    else {
      return 'page';
    }
  }
}